#include<iostream>
#include<signal.h>
#include<unistd.h>
#include<string.h>

void sigcb(int signnum)
{
    std::cout<<"I get signal;signum:"<<signnum<<std::endl;
}

int main()
{
    struct sigaction act; 
    struct sigaction oact;
    memset(&act,0,sizeof(act));
    memset(&oact,0,sizeof(act));
    act.sa_handler=sigcb;

    sigaction(SIGINT,&act,&oact); 

    while(1)
    {
        std::cout<<"My pid is "<<getpid()<<std::endl;
        sleep(1);
    }

    return 0;
}